# 937 简单：重新排列日志文件

def reorderLogFiles(logs):
    # nums = []
    # alpha = []
    #
    # for log in logs:
    #     temp = log.split(' ', 2)
    #     if temp[1][0].isdigit():
    #         nums.append(log)
    #     else:
    #         alpha.append(log)
    #
    # def sortMethod(str1, str2):
    #     str1 = str1.split(' ', 2)
    #     str2 = str2.split(' ', 2)
    #     if str1[1] == str2[1]:
    #         return str1[0]
    #
    # print(nums, alpha)

    def cmp(log):
        a, b = log.split(' ', 1)
        print(a, b)
        return [0, b, a] if b[0].isalpha() else [1, ]

    logs.sort(key=cmp)
    return logs


print(reorderLogFiles(["dig1 8 1", "let1 art can", "dig2 3 6", "let2 own dig", "let3 art zero"]))
